package com.zz.cc.business.app;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.CompoundButton.OnCheckedChangeListener;

import com.zz.cc.business.R;
import com.zz.cc.business.R.id;
import com.zz.cc.business.R.layout;
import com.zz.common.app.BaseActivity;

public class BaseInfoActivity extends BaseActivity implements OnClickListener, OnCheckedChangeListener {
	
	private static final int REQUEST_CODE_FOR_REGISTER = 100;
	
	private EditText mUserNameInput;
	private EditText mPasswordInput;
	private EditText mEnsureInput;
	private EditText mBusinessNameInput;
	private EditText mAddressInput;
	private EditText mPhoneNumInput;
	private EditText mIdInput;
	
	private Button mNext;
	
	private RadioButton mTipsChecker;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_base_info);
		initUI();
		fillView();
	}
	
	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		
		if(requestCode == REQUEST_CODE_FOR_REGISTER) {
			finish();
			overridePendingTransition(R.anim.activity_slide_left_in, R.anim.activity_slide_right_out);
		}
	}
	
	private void initUI() {
		mUserNameInput = (EditText) findViewById(R.id.login_input_user_name);
		mPasswordInput = (EditText) findViewById(R.id.login_input_password);
		mEnsureInput = (EditText) findViewById(R.id.login_input_ensure);
		mBusinessNameInput = (EditText) findViewById(R.id.login_input_business_name);
		mAddressInput = (EditText) findViewById(R.id.login_input_address);
		mPhoneNumInput = (EditText) findViewById(R.id.login_input_phone_number);
		mIdInput = (EditText) findViewById(R.id.login_input_id);
		
		
		mNext = (Button) findViewById(R.id.register_next);
		mTipsChecker = (RadioButton) findViewById(R.id.register_tips);
	}
	
	private void fillView() {
		mNext.setOnClickListener(this);
		mTipsChecker.setOnCheckedChangeListener(this);
	}
	
	private void gotoNext() {
		Intent intent = new Intent(this, BusinessDetailActivity.class);
		startActivityForResult(intent, REQUEST_CODE_FOR_REGISTER);
		overridePendingTransition(R.anim.activity_slide_right_in, R.anim.activity_slide_left_out);
	}

	@Override	//View.OnClickListener
	public void onClick(View v) {
		int id = v.getId();
		if(id == R.id.register_next) {
			gotoNext();
		}
	}

	@Override	//OnCheckChangedListener
	public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				
	}

}
